﻿using UnityEngine;
using System.Collections;

public class AsteroidMover : MonoBehaviour {
       Rigidbody rb;
    // Use this for initialization
    void Start () {
        rb = gameObject.GetComponent<Rigidbody>();
    }
	
	// Update is called once per frame
	void Update () {
        transform.Translate(new Vector3(0, 0, -0.1f));
        transform.position= new Vector3(transform.position.x, 0f, transform.position.z);
        if (gameObject.transform.position.z < -6)
            Destroy(gameObject);
        if (gameObject.transform.position.z > 8)
            Destroy(gameObject);
    }
}

